<!DOCTYPE html>
<html>
    <head>
        <!-- 页面meta -->
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>传智健康</title>
        <meta name="description" content="传智健康">
        <meta name="keywords" content="传智健康">
        <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
        <!-- 引入样式 -->
        <link rel="stylesheet" href="../plugins/elementui/index.css">
        <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
        <link rel="stylesheet" href="../css/style.css">
        <script src="../plugins/echarts/echarts.js"></script>
    </head>
    <body class="hold-transition">
        <div id="app">
            <div class="content-header">
                <h1>会员管理<small>会员数据</small></h1>
                <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
                    <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                    <el-breadcrumb-item>会员管理</el-breadcrumb-item>
                    <el-breadcrumb-item>会员数据</el-breadcrumb-item>
                </el-breadcrumb>
            </div>
            <div class="app-container">
                <div class="box">
                    <div class="filter-container">
                       开始日期 <el-input placeholder="格式:2019-01" v-model="startTime" style="width: 200px;" class="filter-item"></el-input>
                       结束日期 <el-input placeholder="格式:2019-01" v-model="endTime" style="width: 200px;" class="filter-item"></el-input>
                        <el-button @click="getTime()" class="dalfBut">查询</el-button>
                    </div>
                </div>
                <!--折线图位置-->
                <div class="box">
                    <!-- 为 ECharts 准备一个具备大小（宽高）的 DOM -->
                    <div id="chart1" style="height:600px;"></div>
                </div>
            </div>
        </div>
    </body>
    <!-- 引入组件库 -->
    <script src="../js/vue.js"></script>
    <script src="../plugins/elementui/index.js"></script>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script src="../js/axios-0.18.0.js"></script>

    <script>



            //-------------------------------
            // xAxis: {
            //     type: 'category',
            //     data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
            // },
            // yAxis: {
            //     type: 'value'
            // },
            // series: [{
            //     data: [820, 932, 901, 934, 1290, 1330, 1320],
            //     type: 'line'
            // }]


        var vue = new Vue({
            el: '#app',
            data: {

                backend_url: "http://localhost:9002",
                startTime: '',
                endTime: '',
                memberOption : {
                    title: {
                        text: '会员数量'
                    },
                    tooltip: {},
                    legend: {
                        data: ['会员数量']
                    },
                    xAxis: {
                        data: ["2018.01", "2018.02", "2018.03", "2018.04"]
                    },
                    yAxis: {
                        type: 'value'
                    },
                    series: [{
                        name: '会员数量',
                        type: 'line',
                        data: [13, 14, 28, 30]
                    }]

                }

            },

            methods: {
                getTime() {
                    var param = {
                        startTime: this.startTime,
                        endTime: this.endTime

                    };
                    axios.defaults.withCredentials = true;
                    axios.post("http://localhost:9002/report/getMemberReport.do", param).then((res) => {
                        if (res.data.flag) {

                            this.memberOption.xAxis.data = res.data.data.months;
                            this.memberOption.series[0].data = res.data.data.memberCount;
                            //    测试一下上传
                            console.log(this.memberOption.xAxis.data)
                            console.log(this.memberOption.series[0].data)

                            var myChart = echarts.init(document.getElementById('chart1'));

                            myChart.setOption(vue.memberOption);
                        }
                        ;
                    })

                }
            }

        })


    </script>
</html>